package xin.nick.roc.consumer.client;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import xin.nick.rpc.pojo.User;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author Nick
 * @date 2021/7/4
 * @description
 */
@Slf4j
@Service
public class MyCacheManager {
    private static final Map cacheMap = new ConcurrentHashMap();

    public Object get(String key) {
        return cacheMap.get(key);
    }

    public <T> T get(String key, Class<T> clazz) {
        return clazz.cast(cacheMap.get(key));
    }

    public Object set(String key, Object value) {
        return cacheMap.put(key, value);
    }

}
